package Test;

public class Animal {

     void eat() {
        System.out.println("父类eat方法");
    }

    public static void main(String[] args) {
        Animal animal = new Dog();
        animal.eat();
        Animal animal1 = new Lion();
        animal1.eat();
    }
}
    class Dog extends Animal{

        public void eat() {
            System.out.println("这是eat方法的重写");
        }
    }
    class Lion extends Animal{

        public void eat() {
            System.out.println("这是eat方法的重载");

        }
    }

